<template>
  <div class="scroll">
    <example-card title="消息提示" url="http://element.eleme.io/#/zh-CN/component/message">
      <div>
        <el-button :plain="true" @click="open">打开消息提示</el-button>
        <el-button :plain="true" @click="openVn">VNode</el-button>
        <el-button :plain="true" @click="openHTML">使用 HTML 片段</el-button>
        <el-button :plain="true" @click="openGlobal">非组件内使用</el-button>
      </div>
      <div>
        <el-button :plain="true" @click="success">成功</el-button>
        <el-button :plain="true" @click="warning">警告</el-button>
        <el-button :plain="true" @click="error">错误</el-button>
      </div>
    </example-card>
  </div>
</template>

<script>
  import { Message } from "element-ui";

  export default {
    name: "notice_message_view",
    methods: {
      open() {
        this.$message('这是一条消息提示');
      },
      openVn() {
        const h = this.$createElement;
        this.$message({
          showClose: true,
          center: true,
          message: h('p', null, [
            h('span', null, '内容可以是 '),
            h('i', { style: 'color: teal' }, 'VNode')
          ])
        });
      },
      openHTML() {
        this.$message({
          dangerouslyUseHTMLString: true,
          message: '<strong>这是 <i>HTML</i> 片段</strong>'
        });
      },
      openGlobal() {
        Message("非 this.$message 调用");
      },
      success() {
        this.$message({
          showClose: true,
          message: '恭喜你，这是一条成功消息',
          type: 'success'
        });
      },
      warning() {
        this.$message({
          showClose: true,
          message: '警告哦，这是一条警告消息',
          type: 'warning'
        });
      },
      error() {
        this.$message({
          showClose: true,
          message: '错了哦，这是一条错误消息',
          type: 'error'
        });
      }
    }
  };
</script>

<style scoped>

</style>
